package java56_6;

public abstract class Pet {
	private String name;
	protected int age;
	private final String sex;

	public Pet() {
		sex = "公";
	}

	public Pet(String name, int age, String sex) {
		super();
		this.name = name;
		this.age = age;
		this.sex = sex;
	}

	// 宠物的叫声
	public abstract void shout();

	public void print() {
		System.out.println("这个宠物名字叫" + name + "，今年" + age + "岁了，性别是" + sex);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public String getSex() {
		return sex;
	}

	/*
	 * public void setSex(String s) { sex = s; }
	 */

	// ALt + /
	@Override
	public String toString() {
		return "宠物[名字叫" + name + ",性别" + sex + ",年龄" + age + "]";
	}

	public static void show() {
		System.out.println("这是一群宠物");
	}
}
